<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.js" type="application/javascript"></script>
</head>
<body>
  <div id="app">
    <el-input :username="username" :disabled="isdisable"></el-input>
  </div>
</body>
<script>
  Vue.component('el-input', {
    // 子组件通过props接受父组件传过来的数据
    props:{
      username:{
        type:String,
        required:true
      }
    },
    mounted () { //子组件通过props和$attrs接收数据
    console.log('$attrs',this.$attrs);
    },
    template: `
      <input :value='username' :disabled="$attrs.disabled"></input>
    `
  })
  new Vue({
    data() {
      return {
        username:'zs', //定义数据
        isdisable:true
      }
    },
    el: '#app'
  })
</script>
</html>
